<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		<button onclick="redbutton()">红色按钮</button>
		<button onclick="lanbutton()">蓝色按钮</button>
		
		<h1 class="wz">JavaScript 函数是被设计执行特定任务的代码块。</h1>
		<h1 class="wz">JavaScript 函数会在某代码调用它的时被执行</h1>
	</body>
</html>


<script>
	var w1 = document.getElementsByClassName("wz")[0]
	var w2 = document.getElementsByClassName("wz")[1]
	function redbutton(){
		w1.style.color="red";
		w2.style.color="red";
	}
	function lanbutton(){
		w1.style.color="blue";
		w2.style.color="blue";
	}
	
</script>